Chris Pollett > Old Classes >
CS174

( Print View )

Grades: [Sec1]  [Sec2]

Submit: [Sec1]  [Sec2]

Course Info:
  [Texts & Links]
  [Topics]
  [Grading]
  [HW Info]
  [Exam Info]
  [Regrades]
  [Honesty]
  [Announcements]

HW Assignments:
  [Hw1]  [Hw2]  [Hw3]
  [Hw4]  [Hw5]

Practice Exams:
  [Mid1]  [Mid2]  [Final]

                            












CS174 Spring 2002Practice Final

The practice final is below. Here are some facts about the actual final: (a) The final will be in class May 20 9:45am-12pm (Sec 1) and May 22 9:45am-12pm (Sec 2). (b) It is closed book, closed notes. Nothing will be permitted on your desk except your pen (pencil) and test. (c) You should bring photo ID. (d) There will be more than one version of the test. Each version will be of comparable difficulty. (e) If your cell-phone or beeper goes off you will be excused from the test at that point and graded on what you have done till your excusal. (f) One problem (less typos) on the actual test will be from the practice test.

1. Give the Java code neccessary to show a ServerSocket listening to port
   2000 which when it accepts a connection writes to its output stream the
   String "I'm busy" and closes the connection.

2. Explain with a code example how the Runnable interface can be used in
   creating threads that do what you want.

3. Give fragments of Perl programs which use regular expressions to do each of
   the following:
   
   (i) Replace all occurrences of gold in a string $a with lead.
   (ii) Output Hurray! if a file in the current directory has h in it. 
   (iii) The string $a begins with 100 occurrences of 10A.

4. For each of the following HTTP response code ranges say what kind of 
   messages it contains and give a particular numbered code and what it
   means.

   (i) 200-299
   (ii) 400 - 499
   (iii) 500 - 599

5. Explain how to decode the QUERY_STRING CGI variable in Perl.

6. Suppose you use (i) BrowserX to follow a link from the page (ii) 
   http://somewhere.com to the page (iii) http://somewhere.else.com . 
   How would the HTTP GET request look like that spells out (i), (ii),
   and (iii)? 
 

7. Write a Perl program bob.cgi which keeps track of the number of times 
   clients from any distinct site request it. It then outputs a page 
   with a table on it with one row for each site containing the site name 
   and the number of time requests were made. 

8. Redo the last exercise in PHP.

9. For each of the following say in which of Javascript, Java,
   Perl, or PHP it would be a valid fragment of code.

  (i) switch($i)
      {
         case 1:
           print "hello";
           break;
      }

  (ii) $a = [ 1, 2, 3];

  (iii) foreach $a (@c)
        {
            print $a;
        }

10. List the names of three implicit defined JSP objects and give three 
    types of implicitly defined PHP variables.